/**
 * Copyright 2017 orivil Authors. All rights reserved.
 * Use of this source code is governed by a MIT-style
 * license that can be found at https://mit-license.org.
 */

package swagger

// A single security scheme definition, mapping a "name" to the scheme it defines.
type SecurityDefinitions map[string]*SecurityScheme

// Each name must correspond to a security scheme which is declared in the Security Definitions.
// If the security scheme is of type "oauth2", then the value is a list of scope names required
// for the execution. For other security scheme types, the array MUST be empty.
type SecurityRequirement map[string][]string

type SecurityScheme struct {
	// Required.
	// Validity: Any
	// The type of the security scheme.
	// Valid values are "basic", "apiKey" or "oauth2".
	Type string `json:"type"`

	// Validity: Any
	// A short description for security scheme.
	Description string `json:"description,omitempty"`

	// Required.
	// Validity: apiKey
	// The name of the header or query parameter to be used.
	Name string `json:"name,omitempty"`

	// Required.
	// Validity: apiKey
	// The location of the API key.
	// Valid values are "query" or "header".
	In string `json:"in,omitempty"`

	// Required.
	// Validity: oauth2
	// The flow used by the OAuth2 security scheme.
	// Valid values are "implicit", "password", "application" or "accessCode".
	Flow string `json:"flow,omitempty"`

	// Required.
	// Validity: oauth2 ("implicit", "accessCode")
	// The authorization URL to be used for this flow.
	// This SHOULD be in the form of a URL.
	AuthorizationUrl string `json:"authorizationUrl,omitempty"`

	// Required.
	// Validity: oauth2 ("password", "application", "accessCode")
	// The token URL to be used for this flow.
	// This SHOULD be in the form of a URL.
	TokenUrl string `json:"tokenUrl,omitempty"`

	// Required.
	// Validity: oauth2
	// The available scopes for the OAuth2 security scheme.
	Scopes Scopes `json:"scopes,omitempty"`
}